// 封装购物车相关的接口
import request from '@/utils/http'

/**
 * @description: 加入购物车API
 * @param {*}
 * @return {*}
 */
export const insertCartAPI = ({skuId, count}) => {
    return request({
      url: '/member/cart',
      method: 'POST',
      data: {
        skuId,
        count
      }
    })
}

/**
 * @description: 获取最新的购物车列表API
 * @param {*}
 * @return {*}
 */
export const findNewCartListAPI = () => {
    return request({
      url: '/member/cart'
    })
}

/**
 * @description: 删除购物车列表API
 * @param {*}
 * @return {*}
 */
export const delCartAPI = (ids) => {
    return request({
      url: '/member/cart',
      method: 'DELETE',
      data: {
        ids
      }
    })
}

/**
 * @description: 合并购物车列表API
 * @param {*}
 * @return {*}
 */
export const mergeCartAPI = (data) => {
    return request({
      url: '/member/cart/merge',
      method: 'POST',
      data
    })
}

/**
 * @description: 添加收货地址
 * @param {*}
 * @return {*}
 */
export const addAddressAPI = (data) => {
  return request({
    url: '/member/address',
    method: 'POST',
    data
  })
}